import yaml

global random_state, lesinn_t, lesinn_phi, moving_average_window, moving_average_stride

with open("./detector/detector-config.yml", "r", encoding="utf8") as file:
    config = yaml.load(file, Loader=yaml.FullLoader)

if "sample_score_method" in config.keys():
    sample_score_config = config["sample_score_method"]
    if "lesinn" in sample_score_config.keys():
        lesinn_t = int(sample_score_config["lesinn"]["t"])
        lesinn_phi = int(sample_score_config["lesinn"]["phi"])
    if "moving_average" in sample_score_config.keys():
        moving_average_window = int(sample_score_config["moving_average"]["window"])
        moving_average_stride = int(sample_score_config["moving_average"]["stride"])

if "global" in config.keys():
    global_config = config["global"]
    if "random_state" in global_config.keys():
        random_state = int(global_config["random_state"])
